package com.qch.demo;

/**
 * @Author qch
 * @Date 2021/8/7
 * -Xmx20m -Xms5m
 */
public class TestVM {
    public static void main(String[] args) {
        //补充
        // byte[] b=new byte[20*1024*1024];
        System.out.println("分配了1M空间给数组");
        System.out.print("Xmx=");
        System.out.println(Runtime.getRuntime().maxMemory() / 1024.0 / 1024 + "M");
        System.out.print("free mem=");
        System.out.println(Runtime.getRuntime().freeMemory() / 1024.0 / 1024 + "M");
        System.out.print("total mem=");
        System.out.println(Runtime.getRuntime().totalMemory() / 1024.0 / 1024 + "M");
    }
}
